using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using Granite.Commons.Metadata;

namespace LeadTracker.Models
{
	public class LeadModel : global::Granite.Modeling.ChangeTrackingModelBase
	{
		public LeadModel()
		{

		}

		public LeadModel(IDictionary<string, object> fields)
		{
			Load(fields);
		}

		[CalculatedField("LeadKey")]
		public bool IsNew
		{
			get { return !LeadKey.HasValue; }
		}


		[Action("Select")]
		[Action("Delete")]
		public int? LeadKey
		{
			get { return GetOrDefault<int?>("LeadKey"); }
		}

		[Action("Insert")]
		[Action("Update")]
		[Required]
		[StringLength(254)]
		public string Title
		{
			get { return GetOrDefault("Title", ""); }
			set { SetValue("Title", value); }
		}

		[Action("Insert")]
		[Action("Update")]
		public int? OwnerKey
		{
			get { return GetOrDefault<int?>("OwnerKey"); }
			set { SetValue("OwnerKey", value); }
		}


		public int? CreatedByKey
		{
			get { return GetOrDefault<int?>("CreatedByKey"); }
		}


		public DateTimeOffset? CreatedDate
		{
			get { return GetOrDefault<DateTimeOffset?>("CreatedDate"); }
		}


		public int? UpdatedByKey
		{
			get { return GetOrDefault<int?>("UpdatedByKey"); }
		}


		public DateTimeOffset? UpdatedDate
		{
			get { return GetOrDefault<DateTimeOffset?>("UpdatedDate"); }
		}

		[Action("Insert")]
		[Action("Update")]
		public LeadType LeadTypeKey
		{
			get { return GetOrDefault<LeadType>("LeadTypeKey"); }
			set { SetValue("LeadTypeKey", value); }
		}

		[Action("Insert")]
		[Action("Update")]
		public LeadStatus LeadStatusKey
		{
			get { return GetOrDefault<LeadStatus>("LeadStatusKey"); }
			set { SetValue("LeadStatusKey", value); }
		}




	}
}
